[id].vue 821 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <div
  3. v-if="photos"
  4. class="flex flex-col gap-2"
  5. >
  6. <h1
  7. class="text-2xl text-center pt-2 font-semibold"
  8. v-text="photos.title"
  9. />
  10. <div class="flex flex-col gap-5 p-1 mb-2">
  11. <img
  12. v-for="(photo, idx) of photos.photos"
  13. :key="idx"
  14. :src="photo"
  15. class="rounded-md"
  16. >
  17. </div>
  18. </div>
  19. <div
  20. v-else
  21. class="w-screen h-full flex justify-center items-center"
  22. >
  23. <ILoader class="w-16 h-16 text-foreground" />
  24. </div>
  25. </template>
  26. <script setup lang="ts">
  27. const { $api } = useNuxtApp()
  28. const { params: { id } } = useRoute('gallery-id')
  29. const photos = ref<object>()
  30. definePageMeta({
  31. name: 'Фотографии',
  32. middleware: ['user-only'],
  33. })
  34. onMounted(async () => photos.value = await $api.gallery.getPhotos(id))
  35. </script>